//
//  ViewForSectionFooter.m
//  ProjectA
//
//  Created by dllo on 16/1/29.
//  Copyright © 2016年 刘旺辉. All rights reserved.
//

#import "ViewForSectionFooter.h"
#import "ModelForSectionFooter.h"
#import "AppMacro.h"
@interface ViewForSectionFooter ()
@property (nonatomic, strong) UIView *view;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UILabel *label;
@end

@implementation ViewForSectionFooter
- (void)dealloc {
    [_view release];
    [_imageView release];
    [_label release];
    [super dealloc];
}
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        self.view = [[UIView alloc] init];
        [self.contentView addSubview:self.view];
        [_view release];
        
        self.imageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageView];
        [_imageView release];
        
        self.label = [[UILabel alloc] init];
        [self.contentView addSubview:self.label];
        [_label release];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.view.frame = CGRectMake(20, 10, self.bounds.size.width - 40, 1);
    self.imageView.frame = CGRectMake(20, 40, 20, 20);
    self.label.frame = CGRectMake(50, 40, self.bounds.size.width - 40, 20);
    
    [UIView setColorWithView:self.view nightColor:L_COLOR_WHITE dayColor:L_COLOR_LIGHTGRAY];
    [UIView setColorWithLabelView:self.label nightColor:RGBA(52, 52, 52, 1) dayColor:L_COLOR_CLEAR];
    [UIView setColorWithLabelText:self.label nightColor:L_COLOR_WHITE dayColor:L_COLOR_BLACK];

    
    
    if (ISNIGHT) {
        [self.imageView setImage:[UIImage imageNamed:@"iconfont-shijian(baise)"]];
    } else {
        [self.imageView setImage:[UIImage imageNamed:@"iconfont-shijian(heise)"]];
    }
    
}
- (void)passData:(ModelForSectionFooter *)model {
    NSMutableString *str = model.date_tour.mutableCopy;
    [str replaceCharactersInRange:[str rangeOfString:@"T"] withString:@" "];
    NSRange range = [str rangeOfString:@"+"];
    NSString *temp = [str substringToIndex:range.location];
    self.label.text = temp;
    
}
@end
